package com.xiu.travel.security.service;

import com.xiu.travel.entity.UmsMember;
import com.xiu.travel.other.UmsMemberDTO;
import com.xiu.travel.other.UmsMemberVO;
import com.xiu.travel.security.pojo.SecurityUser;
import com.xiu.travel.util.api.CommonResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 * <p>
 * 会员表 服务类
 * </p>
 *
 * @author YuLing
 * @since 2023-03-15
 */
public interface UmsMemberService extends IService<UmsMember> {

    /**
     * 保存
     *
     * @param dto 参数
     * @return 保存结果
     */
    boolean saveOne(UmsMemberDTO dto);

    /**
     * 修改
     *
     * @param dto 参数
     * @return 修改结果
     */
    boolean updateById(UmsMemberDTO dto);

    /**
     * 根据主键查询VO
     *
     * @param id 主键
     * @return VO
     */
    UmsMemberVO getByPk(Long id);


    /**
     * 根据主键删除
     *
     * @param id 主键
     * @return 删除结果
     */
    Boolean deleteByPk(Long id);

    /**
     * 支持分页的dto条件查询
     *
     * @param page  分页组件
     * @param param 查询参数
     * @return IPage
     */
    IPage<UmsMemberVO> selectPageByDto(IPage<UmsMember> page, UmsMemberDTO param);

    CommonResult<String> loadUserByUsername(String username, String password);

    CommonResult<String> loadUserByMail(String mail, String password);

    CommonResult<String> loginOut();

    CommonResult<String> loginBySms(String phone, String code, String password);

    CommonResult<String> loginByWeChat(String openIdCode, String phoneCode);

    CommonResult<String> getSms(String phone) throws Exception;

    CommonResult<String> loginByWeChatToZJH(String openIdCode, String phoneCode) throws Exception;

    SecurityUser getSecurityUserByUmsMember(UmsMember umsMember);
}
